import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    resolve: {
        alias: {
            "@": resolve(__dirname, "src"),
        },
        extensions: [".ts", ".vue", ".js", ".jsx", ".tsx"], // 导入时想要省略的扩展名列表。
    },
    server: {
        proxy: {
            // // 字符串简写写法
            // "/foo": "http://localhost:4567",
            // 选项写法
            "/apis": {
                target: "https://www.dance365.com/apis",
                changeOrigin: true,

            },
            "/api": {
                target: 'http://gmall-h5-api.atguigu.cn',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/app-dev/, '')
            }
        },
    },
});

